/**
 * 
 */
package com.huangliusong.validator;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

import org.springframework.beans.factory.annotation.Autowired;

import com.huangliusong.HelloService;

/**
 * @author huangliusong
 *
 */
public class MyConstrainValidator implements ConstraintValidator<MyConstraint, Object> {
	@Autowired
	private HelloService helloService;
	@Override
	public void initialize(MyConstraint arg0) {
		// TODO Auto-generated method stub
		System.out.println("validate init");
	}

	@Override
	public boolean isValid(Object value, ConstraintValidatorContext context) {
		// TODO Auto-generated method stub
		//写校验的逻辑
		helloService.greeting("呵呵");
		System.out.println(value);	
		return false;
	}

}
